package com.example.xiaomi.controller;

import com.example.xiaomi.entity.contents;
import com.example.xiaomi.entity.hot;
import com.example.xiaomi.entity.userinfo;
import com.example.xiaomi.service.HotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@RequestMapping("hot")
@CrossOrigin  //允许跨域
public class HotController {
    @Autowired
    private HotService service;
    /**
     * http://localhost:8080/hot/list #输入话题所有的信息
     * @return
     */
    @GetMapping("/list")
    public List<hot> getAllHot(String startDate,String endDate) {
        List<hot> HotList = service.findAllhot(startDate, endDate);
        return HotList;
    }

    /**
     * http://localhost:8080/hot/countlist #输入话题所有的信息
     * @return
     */
    @GetMapping("/countlist")
    public List<contents> getAllCount(String Date){
        return service.findAllcount(Date);
    }

    /**
     * http://localhost:8080/hot/hotcontents
     * @return
     */
    @GetMapping("/hotcontents")
    public List<hot>getAllhotcontents(){
        return service.findAllhotcontents();
    }
    /**
     * http://localhost:8080/hot/topuser
     * @return
     */
    @GetMapping("/topuser")
    public List<userinfo>getAlltopuser(){
        return service.findAlltopuser();
    }

    /**
     * http://localhost:8080/hot/typecount
     * @return
     */
    @GetMapping("/typecount")
    public List<userinfo>getAlltypecount(){
        return service.findAlltypecount();
    }

    /**
     * http://localhost:8080/hot/keytopic
     * @return
     */
    @GetMapping("/keytopic")
    public List<hot>getAllkeytopic(String topic){return service.findAllkeytopic(topic);}
    /**
     * http://localhost:8080/hot/topiccontents
     * @return
     */
    @GetMapping("/topiccontents")
    public List<hot>getAlltopiccontents(String topic){return service.findAlltopiccontents(topic);}
}
